package com.yuqiao.read.design.one;

public abstract class Duck {
     FlyBehavior flyBehavior;
     QuackBehavior quackBehavior;
    public abstract void display();
    public void swim(){
        System.out.println("swim...");
    }

   public void perfomFly(){
        flyBehavior.fly();
    }

   public void perfomQuack(){
        quackBehavior.quack();
    }

    public void setFlyBehavior(FlyBehavior flyBehavior){
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior){
        this.quackBehavior = quackBehavior;
    }
}
